
function moveElement(elementID,final_x,final_y,interval) {
  if (!document.getElementById) return false;
  if (!document.getElementById(elementID)) return false;
  var elem = document.getElementById(elementID);
  if (elem.movement) {
    clearTimeout(elem.movement);
  }
  var xpos = parseInt(elem.style.left);
  var ypos = parseInt(elem.style.top);

  if (xpos == final_x && ypos == final_y) {
    return true;
  }
  if (xpos < final_x) {
    xpos+=5;
  }
  if (xpos > final_x) {
    xpos-=5;
  }
  if (ypos < final_y) {
    ypos+=5;
  }
  if (ypos > final_y) {
    ypos-=5;
  }
  if(elem!=null){
      elem.style.left = xpos + "px";
      elem.style.top = ypos + "px";
      var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
      elem.movement = setTimeout(repeat,interval);
  }
}

var page=1;
function go(){page++;if(page==4){page=1};if(page==1){moveElement("preview",0,0,10);}if(page==2){moveElement("preview",-168,0,10);}if(page==3){ moveElement("preview",-342,0,10);}}

function prepareSlideshow() {
// Make sure the browser understands the DOM methods
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
// Make sure the elements exist
  if (!document.getElementById("linklist")) return false;
  if (!document.getElementById("preview")) return false;
// Apply styles to the preview image
    setInterval("go()",3000);
  var preview = document.getElementById("preview");
  preview.style.position = "absolute";
  preview.style.left = "0px";
  preview.style.top = "0px";
// Get all the links in the list
  var list = document.getElementById("linklist");
  var links = list.getElementsByTagName("a");
// Attach the animation behavior to the mouseover event
  links[0].onmouseover = function() { moveElement("preview",0,0,10);}
  links[1].onmouseover = function() { moveElement("preview",-168,0,10); }
  links[2].onmouseover = function() { moveElement("preview",-342,0,10);}
}

